package com.ayi.servlet.backstage; /**
 * @author Ayingzz
 * @create 2021/12/6 22:26
 */

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "adminEditStatusChangeServlet", value = "/adminEditStatusChangeServlet")
public class adminEditStatusChangeServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        int id = Integer.parseInt(request.getParameter("id"));
        int status = Integer.parseInt(request.getParameter("status"));
        Map<Integer, Integer> adminIdMap = (Map<Integer, Integer>) request.getSession().getAttribute("adminIdMap");
        adminIdMap.put(id, status);
        request.getSession().setAttribute("adminIdMap", adminIdMap);
        request.getRequestDispatcher("userManage.jsp").forward(request, response);
    }
}
